<?php
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($_SERVER['DOCUMENT_ROOT']."/Modules/MF93FL27/modconf.mex");
MYTCONN();

	$nrows = $_POST['n_rows'];
	
	$qrNewMultiStk = "INSERT 
		INTO bonus_productstocks (bss_Product, bss_Provider, bss_Office, bss_Status, bss_IniQuant, bss_CrrQuant,bss_Time,bss_nostock)
		VALUES ";
	for ($i=1; $i<=$nrows;$i++) {
		if ($_POST['bss_IniQuant'.$i] > 0) {
			if ($_POST['bss_Provider'.$i] < 1) { $_POST['bss_Provider'.$i] = 0; }
			$qrNewMultiStk .= "({$_POST['bss_Product'.$i]},{$_POST['bss_Provider'.$i]},{$_POST['bss_Office'.$i]},{$_POST['bss_Status'.$i]},{$_POST['bss_IniQuant'.$i]},{$_POST['bss_IniQuant'.$i]},'{$_POST['bss_Time'.$i]}',0),";
		}	
	}
	$qrNewMultiStk = substr($qrNewMultiStk,0,strlen($qrNewMultiStk)-1);
	if ($GLOBALS['MYT']->db_query($qrNewMultiStk)==true) {
	echo '<div class="Confirm">Guardado</div>
		<script charset="utf-8" type="text/javascript">Ext.getCmp(\'winmltentry\').close();</script>';
	
	}